package com.zhao.concreteIterator;

import com.zhao.User;
import com.zhao.iterator.UserIterator;

import java.util.List;

public class UserIteratorImpl implements UserIterator {

    private List<User> userList;

    private Integer position = 0;

    public UserIteratorImpl(List<User> userList) {
        this.userList = userList;
    }

    @Override
    public boolean hasNext() {
        return position < userList.size();
    }

    @Override
    public User next() {
        return userList.get(position++);
    }
}
